public class ColPlayers 
{
    /* Variaveis de instancia */
    private final Player[] players;
    private int numberOfPlayersRegistered;
    
    /**
     * 
     */
    public ColPlayers()
    {
        numberOfPlayersRegistered = 0;
        players = new Player[Game.MAX_PLAYERS];
        initializeVector();
    }
    
    /**
     * 
     */
    private void initializeVector()
    {
        for (int i = 0; i < Game.MAX_PLAYERS; i++ )
            players[i] = new Player(i + Game.ARRAY_OFFSET);
    }
    
    /**
     * 
     * @param color
     * @param name 
     */
    public void addPlayer(int color, String name)
    {
        int index = color - Game.ARRAY_OFFSET;
        
        if (players[index].getName().equals(Player.defaultName))
            numberOfPlayersRegistered++;
        
        players[index].setName(name);
    }
    
    /**
     * 
     * @param color
     * @return 
     */
    public Player getPlayer(int color)
    {
        return players[color - Game.ARRAY_OFFSET];
    }
    
    /**
     * 
     * @return 
     */
    public boolean hasAllPlayersRegistered()
    {
        return numberOfPlayersRegistered == Game.MAX_PLAYERS;
    }
}